#ifndef CNC_RTL_RUNTIME_ENVIRONMENT_IMPLEMENTATION_H
#define CNC_RTL_RUNTIME_ENVIRONMENT_IMPLEMENTATION_H

// provided interface
#include "enventities.h"

namespace cnc {

	namespace rtl {

		class RuntimeEnvironment :
			public virtual EnvironmentEntities
		{
			HINSTANCE hInstance_;
			HINSTANCE hPrevInstance_;
			LPTSTR lpszArgument_;
			int nCmdShow_;
		protected:
			RuntimeEnvironment() :
				hInstance_(NULL), hPrevInstance_(NULL),
				lpszArgument_(NULL), nCmdShow_(0) {}
		public:
			EnvironmentEntities *getEnvironmentEntities()
			{
				return static_cast<EnvironmentEntities *>(this);
			}
		protected: // Environment Entities
			virtual void setupEnvironment(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, int nCmdShow)
			{
				hInstance_ = hInstance;
				hPrevInstance_ = hPrevInstance;
				lpszArgument_ = lpszArgument;
				nCmdShow_ = nCmdShow;
			}
			virtual HINSTANCE getInstanceHandle()
			{
				return hInstance_;
			}
			virtual HINSTANCE getPrevInstanceHandle()
			{
				return hPrevInstance_;
			}
			virtual LPTSTR getArgument()
			{
				return lpszArgument_;
			}
			virtual int getCmdShow()
			{
				return nCmdShow_;
			}
		public:
			static RuntimeEnvironment &instance()
			{
				static RuntimeEnvironment object;
				return object;
			}
		};

	} // namespace rtl

} // namespace cnc

#endif

